<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="真实姓名">
              <a-input placeholder="请输入真实姓名" v-model="queryParam.userName">
              </a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
<span style="float: left;overflow: hidden;" class="table-pagesearch-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询
</a-button>
<a-button type="primary" @click="searchReset" icon="reload"
          style="margin-left: 8px">重置</a-button>
<a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
</span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    <!-- 预约记录操作区域 -->
    <span slot="action" slot-scope="text, record">
  <a v-if="record.isFinish === 1" @click="handleRecord(record)">预约记录</a>
  <a-tag v-else color="red">信息未完善</a-tag>
  <a-divider type="vertical"/>
  <a-dropdown>
  <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
  <a-menu slot="overlay">
  <a-menu-item>
<a @click="handleEdit(record)">编辑</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() =>handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
        style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange:onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片
</span>
          <img v-else :src="getImgView(text)" height="25px" alt=""
               style="maxwidth:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件
</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">下载
          </a-button>
        </template>
        <!--信息是否已完善模板-->
        <template slot="isFinish" slot-scope="isFinish">
          <a-tag v-if="isFinish === 1" color="green">是</a-tag>
          <a-tag v-if="isFinish === 2" color="red">否</a-tag>
        </template>
        <span slot="action" slot-scope="text, record">
<a @click="handleRecord(record)">预约记录</a>
<a-divider type="vertical"/>
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
      </a-table>
    </div>
    <sdxc-reserve-user-modal ref="modalForm" @ok="modalFormOk"></sdxc-reserve-user-modal>
      <!--预约记录模态框-->
      <SdxcReserveUserRecordModal ref="SdxcReserveUserRecordModal"></SdxcReserveUserRecordModal>
  </a-card>
</template>
<script>
  import '@/assets/less/TableExpand.less'
  import {mixinDevice} from '@/utils/mixin'
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import SdxcReserveUserModal from './modules/SdxcReserveUserModal'
  import SdxcReserveUserRecordModal from './modules/SdxcReserveUserRecordModal'

  export default {
    name: 'SdxcReserveUserList',
    mixins: [JeecgListMixin, mixinDevice],
    components: {
      SdxcReserveUserModal,SdxcReserveUserRecordModal
    },
    data() {
      return {
        description: '用户管理管理页面',
// 表头
        columns: [
          {
            title: '真实姓名',
            align: "center",
            dataIndex: 'userName'
          },
          {
            title: '身份证号',
            align: "center",
            dataIndex: 'idCard'
          },
          {
            title: '联系电话',
            align: "center",
            dataIndex: 'phone'
          },
          {
            title: '工作单位',
            align: "center",
            dataIndex: 'workUnit'
          },
          {
            title: '信息是否完善',
            align: "center",
            dataIndex: 'isFinish',
            scopedSlots: {customRender: 'isFinish'},
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: "center",
            fixed: "right",
            width: 147,
            scopedSlots: {customRender: 'action'}
          }
        ],
        url: {
          list: "/reserve/sdxcReserveUser/list",
          delete: "/reserve/sdxcReserveUser/delete",
          deleteBatch: "/reserve/sdxcReserveUser/deleteBatch",
        },
        dictOptions: {},
      }
    },
    created() {
    },
    computed: {},
    methods: {
      /**
       * 插看预约记录
       *
       * @param record
       */
      handleRecord: function (record) {
        this.$refs.SdxcReserveUserRecordModal.edit(record);
        this.$refs.SdxcReserveUserRecordModal.title = "预约记录";
        this.$refs.SdxcReserveUserRecordModal.disableSubmit = false;
      },

      initDictConfig() {
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
